<!DOCTYPE html>
<!--suppress ALL-->
<html lang="en" xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" th:href="@{/bootstrap/css/bootstrap.min.css}">
    <link rel="stylesheet" th:href="@{/css/font-awesome.min.css}">
    <link rel="stylesheet" th:href="@{/css/main.css}">
</head>
<body>
<form>
    <table class="table  table-bordered">
        <thead>
        <tr >
            <th width="30">#</th>
            <th width="30"><input type="checkbox"></th>
            <th>商品数量</th>
            <th>商品名称</th>
            <th>订单状态</th>
            <th width="100">操作</th>
        </tr>
        </thead>
        <tbody>
        <tr th:each="o:${pageInfo.list}">
            <td >1</td>
            <td><input type="checkbox" name="orderid"></td>
            <td th:text="${o.orderNum}">Lorem</td>
            <td th:text="${o.gname}">ipsum</td>
            <td th:text="${o.status}">ipsum</td>
            <td>

                <button type="button" th:onclick="|deleteOrder(${o.orderid})|"  class="btn btn-primary btn-xs"><i class=" glyphicon glyphicon-pencil">删除订单</i></button>
                <button type="button" class="btn btn-danger btn-xs"><i class=" glyphicon glyphicon-remove"></i></button>
            </td>
        </tr>
        </tbody>
        <tfoot>
        <tr >
            <td colspan="8" align="center">
                <ul class="pagination">
                    <li><a th:href="@{/user/orderList(now=${pageInfo.prePage}, gname=${gname}, userid=${userid})}">上一页</a></li>
                    <li><a th:each="page : ${pageInfo.getNavigatepageNums()}" th:text="${page}" th:href="@{/user/orderList(now=${page}, gname=${gname}, typeId=${typeId})}">1</a></li>
                    <li><a th:href="@{/user/orderList(now=${pageInfo.nextPage}, gname=${gname}, userid=${userid})}">下一页</a></li>
                </ul>
            </td>
        </tr>

        </tfoot>
    </table>
</form>


<script th:src="@{/jquery/jquery-2.1.1.min.js}"></script>
<script th:src="@{/bootstrap/js/bootstrap.min.js}"></script>
<script th:src="@{/script/docs.min.js}"></script>
<script type="text/javascript" th:inline="javascript">
   function deleteOrder(id) {
       var url=/*[[@{/user/deleteOrder}]]*/
       var orderid="id="+id;
       $.post(url,orderid,function (data) {
           if (data == "1") {
               alert("删除成功")
           }else {
               alert("删除失败")
           }
       })

   }
</script>
</body>
</html>